  $(function(){
	  //显示权限按钮
	  var parentUUID = $("input[name='parentUUID']").val();
   	  $.permission.showButton(parentUUID,"actionBtnArea");
   	  //表格初始化
	  $.dataGridEasyUI.initTable({
		  pageId:"#batchDataInfoListPage",
		  gridId:"#batchDataInfoList",
		  url:getBasePath()+'mdData/getMianGanList.do',
		  toolbarId:"#batchDataInfoListPage .tb_toolbar",
		  columns:[[
	            {field:'mianganCi',title:'敏感词',width:'20%'},
	        ]],
	        frozenColumns:[[    
	        	{field:'id',checkbox:true},
	        	{field:'actionColumn',title:'操作列',width:100,formatter: function(value,row,index){
	        		return "<a href='javascript:deleteCihui(\""+row.mianganCi+"\")' style='color:blue'><b>关联删除词汇</b></a>";
	            }},
	        ]],    
	  });

  //批量删除
  $("#batchDeleteLink").bind("click",function(){
	    var mianganciArray = [];
	    var rows = tableObject.datagrid('getSelections');
		if(rows.length<1){
			$.messager.alert('系统提示','请选中数据后再进行操作！','error');
			return;
		}
		
		//获取datagrid选中行
		for (var i = 0; i < rows.length; i++) {
			mianganciArray.push(rows[i].mianganCi);
		}
		mianganciArray = mianganciArray.join(',');
	  $.dataGridEasyUI.batchDeleteData({
		  url:getBasePath()+"/mdData/batchDeleteCihui.do?mianganciArray="+mianganciArray,
	  });
  });
  
  //单个删除
  $("#singleDeleteLink").bind("click",function(){
	  $.dataGridEasyUI.batchDeleteData({
		  url:getBasePath()+"/mdData/delBatchDataInfo.do",
	  });
  });
 
})

function deleteCihui(mianganCi){
  $.dataGridEasyUI.batchDeleteInDB({
	  url:getBasePath()+"/mdData/deleteCihui.do?mianganCi="+mianganCi,
  });
}
